<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <style type="text/css">
        .header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
    <script language=JavaScript>
        //计算保留多少位小数，后面参数为小数点位数
        function fomatFloat(src, pos) {
            return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
        }
        function IsDigit(cCheck) {
            return ((('0' <= cCheck) && (cCheck <= '9')) || cCheck == '.' || cCheck == '-');
        }
        function checklineInput() {
            var flow_k_num = document.getElementById("maxvaluea");
            var flow_bc_num = document.getElementById("maxvalueb");
            var flow_bz_num = document.getElementById("maxvaluec");

            if (flow_k_num.value == "") {
                alert("请输入被检表的K系数！");
                flow_k_num.focus();
                return false;
            }
            if (CheckNum(flow_k_num.value, "被检表的K系数只能输入数字格式！", flow_k_num) == false)
                return false;

            if (flow_bc_num.value == "") {
                alert("请输入示值工况流量！");
                flow_bc_num.focus();
                return false;
            }
            if (CheckNum(flow_bc_num.value, "示值工况流量只能输入数字格式！", flow_bc_num) == false)
                return false;

            if (flow_bz_num.value == "") {
                alert("请输入标准工况流量");
                flow_bz_num.focus();
                return false;
            }
            if (CheckNum(flow_bz_num.value, "标准工况流量只能输入数字格式！", flow_bz_num) == false)
                return false;
        }


        function CheckNum(charValue, alertValue, obj) {
            for (var iIndex = 0; iIndex < charValue.length; iIndex++) {
                var cCheck = charValue.charAt(iIndex);
                if (!IsDigit(cCheck)) {
                    alert(alertValue);
                    obj.focus();
                    return false;
                }
            }
        }
        function reset(){
            var flow_k_num = document.getElementById("maxvaluea");
            var flow_bc_num = document.getElementById("maxvalueb");
            var flow_bz_num = document.getElementById("maxvaluec");
            var freq_ys_num = document.getElementById("maxvalued");
            var freq_xz_num = document.getElementById("maxvaluee");
            var flow_szwc_num = document.getElementById("maxvaluef");
            flow_k_num.value="";
            flow_bc_num.value="";
            flow_bz_num.value="";
            freq_ys_num.value="";
            freq_xz_num.value="";
            flow_szwc_num.value="";
        }
        function liner_calculation() {

            var flow_k_num = document.getElementById("maxvaluea");
            var flow_bc_num = document.getElementById("maxvalueb");
            var flow_bz_num = document.getElementById("maxvaluec");
            var freq_ys_num = document.getElementById("maxvalued");
            var freq_xz_num = document.getElementById("maxvaluee");
            var flow_szwc_num = document.getElementById("maxvaluef");
            //检查输入
            if (checklineInput() == false) return;
            var flow_k = 0.000, flow_bc = 0.000, flow_bz = 0.000, freq_ys = 0.000;
            var freq_xz = 0.000;
            var flow_szwc = 0.000;
            //给各个变量赋值
            flow_k = flow_k_num.value;
            flow_bc = flow_bc_num.value;
            flow_bz = flow_bz_num.value;
            // 开始计算
            // 原始频率=示值工况流量*仪表K系数（被检表）/3600
            // 修正频率=标准工况流量*仪表K系数（被检表）/3600
            freq_ys = flow_bc*flow_k  / 3600.000;
            freq_xz = flow_bz*flow_k  / 3600.000;
            flow_szwc= ((flow_bc-flow_bz)/flow_bc)*100;
            freq_ys_num.value = fomatFloat(freq_ys, 3);
            freq_xz_num.value = fomatFloat(freq_xz, 3);
            flow_szwc_num.value = fomatFloat(flow_szwc, 2);
        }
    </script>
</head>

<body>
    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-form-list">
            <li class="aui-list-header">1.示值误差线性化计算器</li>

            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        仪表K系数（被检表） (1/m³)
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvaluea">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        示值工况流量 （m³/h）
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvalueb">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        标准工况流量 （m³/h）
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvaluec">
                    </div>
                </div>
            </li>
            <li class="aui-list-header"> 计算结果</li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        原始频率 (Hz)
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvalued">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        修正频率 (Hz)
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvaluee">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        修正前示值误差 (%)
                    </div>
                    <div class="aui-list-item-input">
                        <input type="number" placeholder="Number" id="maxvaluef">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner aui-list-item-center aui-list-item-btn">
                    <div class="aui-btn aui-btn-info aui-margin-r-5" onclick="liner_calculation()">计算</div>
                    <div class="aui-btn aui-btn-danger aui-margin-l-5" onclick="reset()">重置</div>
                </div>
            </li>
            <li class="aui-list-header"> 软件说明</li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                1.此软件适用场合及注意</br></br>
                    
                1）送检时用示值误差来检定的场合；</br>
                2）现场只提供标准流量和被检表点实际示值流量；</br>
                3）实际示值流量和表头的工况流量要一致；</br>
                4）标定前要去掉原有分段，每个分段点的修正频率要改成一致；</br></br>

                2.计算公式</br></br>

                1）原始频率=示值工况流量*仪表K系数（被检表）/3600；</br>
                2）修正频率=标准工况流量*仪表K系数（被检表）/3600；</br>
                3）示值误差=(（示值流量-标准流量）/标准流量)*100;</br>
                </div>
            </li>


        </ul>
    </div>

</body>

</html>